<?php 
//热闹网邀请
class Invited extends Controller 
{	
	function Invited() {
		parent::Controller();
		$this->CI =&get_instance();
		$this->code = $this->CI->config->item("invite_code");
	}
	
	function check()
	{
		if($this->CI->input->post("dopost")){
			$invitedcode = $this->CI->input->post("invitedcode");
			if($invitedcode == $this->code) {
//				$_COOKIE["renao_invited"] = md5($code);
				setcookie("renao_invited",md5($this->code),time()+60*60*24*30*12,"/",".renao100.com");
				header("location:http://www.renao100.com");
			}
		} 
		if(!(isset($_COOKIE["renao_invited"]) && $_COOKIE["renao_invited"] == md5($this->code))) {
			ob_start();
			echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
			$this->CI->load->view("Invited/index");
			$buffer = ob_get_contents();
			ob_end_clean();
			echo $buffer;
			exit;
		}
	}
}
	
?>